<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <script th:src="@{/static/js/jquery-1.9.1.min.js}"></script>
</head>
<body bgcolor="blanchedalmond">
<div style="position: absolute; left: 50%;top: 50%;
           margin-left: -150px;margin-top: -150px; width:
          300px;height: 400px;background-color: whitesmoke">
  <h3 style="text-align: center;margin-top: 20%;">注册</h3>
  <input type="text" style="height: 20px;width: 180px;margin-left: 60px;margin-top: 20px;" placeholder="请输入手机号" id="phone">
  <input type="password" style="height: 20px;width: 180px;margin-left: 20%;margin-top: 20px;" id="password" placeholder="请输入密码">
  <input type="password" style="height: 20px;width: 180px;margin-left: 20%;margin-top: 20px;" id="repassword" placeholder="请二次输入密码">
  <br>
  <button style="width: 190px;margin-left: 20%;margin-top: 20px;" onclick="register()">创建账号</button>
</div>
</body>
<script>
  function register(){
      var p1 = $("#password").val();
      var p2 = $("#repassword").val();
      var ph = $("#phone").val();
      var reg = /^1[0-9]{10}$/;
      if(!reg.test(ph)){
        alert("手机号错误");
        return;
      }
      if(p1!=p2){
        alert("两次密码不一致,请重新输入");
        return;
      }
      location.href ='add?phone='+ph+'&password='+p1;
  }
</script>
</html>